package controller

import (
	"github.com/astaxie/beego"
	"test5/forms"
)

type AuthController struct {
	beego.Controller
}

func (c *AuthController) Login() {
	if c.Ctx.Input.IsPost() {
		var homeform forms.Home
		c.ParseForm(&homeform)
		if homeform.UserName == "sonfer" && homeform.PassWord == "123456" {
			c.SetSession("user", homeform.UserName)
			c.Redirect("/home/user", 302)
		}
	}
	c.TplName = "login.html"

}

func (c *AuthController) Logout() {
	c.DestroySession()
	c.Redirect("/auth/login", 302)
}
